home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1986 September / 1986-09.d64 / video jigsaw (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  6KB  |  192 lines

  1. 10 if aa=1then90
  2. 20 poke53280,0:poke53281,0:print"[147][129]"tab(13)" video jigsaw "
  3. 30 gosub1230:aa=1:print"[147]       loading "n$(a)
  4. 40 print" please wait....[144]"
  5. 50 ifleft$(n$(a),1)="d"thenzz=1
  6. 60 ifleft$(n$(a),1)="[129]"thenzz=2
  7. 70 poke49990,zz
  8. 80 load n$(a),8,1
  9. 90 poke55,0:poke56,92:clr:zz=peek(49990):dim n$(19)
  10. 100 fora=828to873:read d:pokea,d:next
  11. 110 fora=49879to49973:read d:pokea,d:next
  12. 120 print"[147]":poke781,8:poke782,5:poke783,0:sys65520
  13. 130 print"choose size of puzzle pieces:"
  14. 140 print"(smaller numbers give harder puzzles)"
  15. 150 poke781,14:poke782,2:poke783,0:sys65520
  16. 160 print"length (from 2 to 12[146])";:input l$
  17. 170 l=val(l$):ifl<2orl>12then150
  18. 180 poke781,18:poke782,2:poke783,0:sys65520
  19. 190 print "width  (from 2 to 20[146])";:input w$
  20. 200 w=val(w$):ifw<2orw>20then180
  21. 210 print"[147]   once puzzle appears you may see"
  22. 220 print"   picture as it should look when"
  23. 230 print"   finished by pressing f1"
  24. 240 print"[158]   plug joystick into port 2"
  25. 250 print"   puzzle construction will blank"
  26. 260 print"   screen for 1 to 2 minutes"
  27. 270 print"  press any key to start construction"
  28. 280 get k$:ifk$=""then print"[145]";:poke646,peek(56325):goto270
  29. 290 poke53265,peek(53265)and239
  30. 300 ifzz=1thengosub1530
  31. 310 ifzz=2thengosub1570:gosub1530:poke53281,peek(34576)
  32. 320 fora=32704to32767:read d:pokea,d:next
  33. 330 v=53248:sid=54272:xx =24+(w*4-4):yy=50+(l*4)-4
  34. 340 pokesid+5,9:pokesid+6,9
  35. 350 max=xx+(int(40/w)-1)*8*w:myx=yy+(int(25/l)-1)*8*l
  36. 360 dim s(1000):dimc(1000)
  37. 370 def fn hi(m)=int(m/256):def fn lo(m)=m-256*fn hi(m)
  38. 380 for n =0 to int (25/l)-1
  39. 390 for n1=0 to int (40/w)-1
  40. 400 b=b+1
  41. 410 s(b)=24576+n1*(w*8)+n*(l*320)
  42. 420 c(b)=55296+n1*(w)+n*(40*l)
  43. 430 a$=a$+chr$(b)
  44. 440 next n1:nextn
  45. 450 d$=a$:b$=a$
  46. 460 fori=1tob:a=i+int((b+1-i)*rnd(0))
  47. 470 d$=mid$(d$,a,1)+left$(d$,a-1)+right$(d$,b-a)
  48. 480 next
  49. 490 z=int(len(d$)/2)*2-2
  50. 500 fori=1to z step2:x1=asc(mid$(d$,i,1)):x2=asc(mid$(d$,i+1,1))
  51. 510 gosub1020:gosub760
  52. 520 poke53280,i:next:d$=b$:b$=a$
  53. 530 b=1
  54. 540 pokev+28,peek(v+28)or1:pokev+39,7:pokev+37,2:pokev+38,5:pokev,x
  55. 550 pokev+1,y:poke24568,255:pokev+21,1
  56. 560 poke53265,peek(53265)and239
  57. 570 poke53265,59:poke53272,120:poke56576,peek(56576)and254
  58. 580 ifzz=2thenpoke53270,216
  59. 590 poke53265,peek(53265)or16
  60. 600 pokesid+24,15
  61. 610 le=l*8:we=w*8
  62. 620 x=xx:y=yy
  63. 630 getk$:ifk$="[133]"thengosub1150
  64. 640 tg=1-tg:pokev+21,tg:j2=peek(56320)
  65. 650 fr=j2and16:jv=15-(j2and15)
  66. 660 if fr=0thengosub950:goto630
  67. 670 ifjv=1 and y>yy theny=y-le:b=b-int(40/w):goto710
  68. 680 ifjv=2 and y<myx theny=y+le:b=b+int(40/w):goto710
  69. 690 ifjv=4 and x>xx thenx=x-we:b=b-1:goto710
  70. 700 ifjv=8 and x<max thenx=x+we:b=b+1
  71. 710 tr=(x>255)
  72. 720 pokev+16,tr*(-1)
  73. 730 pokev,x+(tr*255):pokev+1,y
  74. 740 goto630
  75. 750 gosub1020:ifb$=d$then en=1
  76. 760 forn=0tol-1:for n1=0tow-1
  77. 770 y1=s(x1)+(n1*8)+(n*320):c1=c(x1)+n1+n*40:v1=c1-31744
  78. 780 y2=s(x2)+(n1*8)+(n*320):c2=c(x2)+n1+n*40:v2=c2-31744
  79. 790 yl=fn lo(y1):yh= fn hi(y1)
  80. 800 xl=fn lo(y2):xh= fn hi(y2)
  81. 810 poke165,yl:poke166,yh:poke167,xl:poke168,xh
  82. 820 sys 828
  83. 830 ifzz=2 then poke49160,peek(c1):pokec1,peek(c2):pokec2,peek(49160)
  84. 840 poke49161,peek(v1):pokev1,peek(v2):pokev2,peek(49161)
  85. 850 next:next
  86. 860 ifen=1then1060
  87. 870 return
  88. 880 poke53270,200:poke53265,27:poke53272,21:poke56576,peek(56576)or1:pokev+21,0
  89. 890 poke53280,0:poke53281,0:print"[147][129]   load another picture puzzle and"
  90. 900 print"         play again (y/n)[146] ";
  91. 910 geta$:ifa$=""then910
  92. 920 ifa$="n"then poke55,0:poke56,160:clr:stop
  93. 930 ifa$="y"thenprint:goto30
  94. 940 goto910
  95. 950 fl=fl+1
  96. 960 iffl=2thenx2=b:ifx2=x1then fl=1:return
  97. 970 if fl=2 then fl=0:gosub990:gosub750:return
  98. 980 x1=b:gosub1000:return
  99. 990 hf=110:lf=0:gosub1010:return
  100. 1000 hf=70:lf=0:gosub1010:return
  101. 1010 pokesid+1,hf:pokesid,lf:pokesid+4,17:pokesid+4,16:return
  102. 1020 ifx1>x2thenx3=x1:x1=x2:x2=x3
  103. 1030 x1$=mid$(b$,x1,1):x2$=mid$(b$,x2,1)
  104. 1040 b$=left$(b$,x1-1)+x2$+mid$(b$,x1+1,x2-x1-1)+x1$+right$(b$,len(b$)-x2)
  105. 1050 return
  106. 1060 for r=0to2
  107. 1070 pokesid+5,85:pokesid+6,85:pokesid+12,85:pokesid+13,85
  108. 1080 pokesid+4,33:pokesid+11,17
  109. 1090 forn=0to5:forx=0to3:v(x)=peek(850+(n*4)+x):next
  110. 1100 pokesid+1,v(0):pokesid,v(1):pokesid+8,v(2):pokesid+7,v(3):poke53280,v(2)
  111. 1110 ifh1=50then for t=1to200:next
  112. 1120 fort=1to125:next:next
  113. 1130 pokesid+4,32:pokesid+11,16:forw=1to500:next:next
  114. 1140 goto880
  115. 1150 ifzz=2thengosub1620
  116. 1160 poke53272,8:poke56576,(peek(56576)and252)or1
  117. 1170 pokev+21,0
  118. 1180 getk$:ifk$<>"[133]"then1180
  119. 1190 ifzz=2thengosub1620
  120. 1200 poke53272,120:poke56576,(peek(56576)and252)or2
  121. 1210 pokev+21,1
  122. 1220 return
  123. 1230 print" please insert disk containing doodle[146]":n=1
  124. 1240 print tab(8);"or koala[146] picture files"
  125. 1245 print"[155]-the gazette disk contains one picture-[129]
  126. 1250 [153]"       press any key when ready"
  127. 1260 [161]k$:[139] k$[178]""[167]1260
  128. 1270 [153]"load"[163]12);" picture files "
  129. 1280 [159]1,8,0,"$"
  130. 1290 [161]#1,b$:[139]st[179][177]0[167]1400
  131. 1300 [139]n[177]19[167]1400
  132. 1310 [139]b$[179][177][199](34)[167]1290
  133. 1320 n$[178]""
  134. 1330 [161]#1,b$:[139]b$[179][177][199](34)[167] n$[178]n$[170]b$:[137]1330
  135. 1340 [161]#1,b$:[139]b$[178][199](32)[167]1340
  136. 1350 [139][200](n$,1)[178]" "[167] n[178]n[171]1:[137]1380
  137. 1360 [139][200](n$,2)[179][177]"dd"[175][200](n$,1)[179][177]"for" [167]n[178]n[171]1:[137]1380
  138. 1370 n$(n)[178]n$:[153][163]12)n$(n)
  139. 1380 [161]#1,b$:[139]b$[179][177]""[167]1380
  140. 1390 [139] st[178]0[167] n[178]n[170]1:[137]1290
  141. 1400 [160]1
  142. 1410 [139]n[178]1[167][153]"      no pictures on this disk":[129]i[178]1[164]2000:[130]:[137]1230
  143. 1420 [153]"  (use cursor up/down to highlight)
  144. 1430 print"    press return to load picture
  145. 1440 a[178]1:c1[178]0:c[178]125:[141]1510
  146. 1450 k[178][194](197):sh[178][194](653):[139]k[179][177]7[175]k[179][177]1[167]1450
  147. 1460 [139]k[178]7[175]sh[178]0[175]a[179](n[171]1)[167]c1[178]1:[141]1500
  148. 1470 [139]k[178]7[175] sh[178]1[175]a[177]1[167]c1[178][171]1:[141]1500
  149. 1480 [139]k[178]1[167][142]
  150. 1490 [137]1450
  151. 1500 [129]i[178]0[164]24:[151]55296[170]i[170](a)[172]40[170]c,8:[130]
  152. 1510 a[178]a[170]c1:[129]i[178]0[164]24:[151]55296[170]i[170](a)[172]40[170]c,1:[130]
  153. 1520 [142]
  154. 1530 [151]49872,0:[151]49873,92:[151]49874,0:[151]49875,96:[151]49876,0
  155. 1540 [151]49877,128:[151]49878,0:[158]49879
  156. 1550 [151]49872,0:[151]49873,96:[151]49874,0:[151]49875,128:[151]49876,0
  157. 1560 [151]49877,160:[151]49878,0:[158]49879:[142]
  158. 1570 [151]49872,64:[151]49873,127:[151]49874,39:[151]49875,131:[151]49876,0
  159. 1580 [151]49877,92:[151]49878,0:[158]49879
  160. 1590 [151]49872,40:[151]49873,131:[151]49874,15:[151]49875,135:[151]49876,0
  161. 1600 [151]49877,216:[151]49878,0:[158]49879
  162. 1610 [151]49877,196:[151]49878,0:[158]49879:[142]
  163. 1620 [151]49872,0:[151]49873,216:[151]49874,0:[151]49875,220:[151]49876,0
  164. 1630 [151]49877,196:[151]49878,1:[158]49879:[142]
  165. 1640 [131] 160,0,177,165,153,0,192,177
  166. 1650 [131] 167,145,165,185,0,192,145,167
  167. 1660 [131] 200,192,8,208,237,96,25,30
  168. 1670 [131] 18,209,33,135,25,30,42,62
  169. 1680 [131] 31,165,50,60,37,162,42,62
  170. 1690 [131] 31,165,50,60,37,162
  171. 1700 [131] 173,210,194,205,208,194,173
  172. 1710 [131] 211,194,237,209,194,144,80,173
  173. 1720 [131] 208,194,133,251,173,209,194
  174. 1730 [131] 133,252,173,212,194,133,253
  175. 1740 [131] 173,213,194,133,254,173,210
  176. 1750 [131] 194,133,247,173,211,194,133
  177. 1760 [131] 248,173,214,194,133,249,160,0
  178. 1770 [131] 177,251,166,249,240,8,133,250
  179. 1780 [131] 177,253,145,251,165,250,145
  180. 1790 [131] 253,230,251,208,2,230,252,230
  181. 1800 [131] 253,208,2,230,254,165,252,197
  182. 1810 [131] 248,208,222,165,247,197,251,48
  183. 1820 [131] 3,76,10,195,96
  184. 1830 [131] 170,192,0,187,0,0,169,0
  185. 1840 [131] 0,183,64,0,193,144,0,0
  186. 1850 [131] 116,0,0,25,0,0,7,64
  187. 1860 [131] 0,1,144,0,0,116,0,0
  188. 1870 [131] 25,0,0,7,0,0,0,0
  189. 1880 [131] 0,0,0,0,0,0,0,0
  190. 1890 [131] 0,0,0,0,0,0,0,0
  191. 1900 [131] 0,0,0,0,0,0,0,197
  192.